<!-- 网站信息 -->
<template>
    <div class="website-information">
        <el-form ref="formRef" class="ls-form" :model="formData" label-width="140px">
            <el-card shadow="never" class="!border-none">
                <div class="text-xl font-medium mb-[20px]">展示设置</div>
               <el-form-item label="合同展示" prop="contract_show">
                    <div class="w-80">
						<el-switch
						  v-model="formData.contract_show"
						 :active-value="1"
						 :inactive-value="0">
						</el-switch>
						<span class="mt-1 ml-2">{{
						    formData.contract_show ? '展示' : '隐藏'
						}}</span>
                    </div>
                </el-form-item>
				<el-form-item label="身份证展示" prop="id_card_show">
				    <div>
				        <el-switch
				            v-model="formData.id_card_show"
				            :active-value="1"
				            :inactive-value="0"
				        />
				        <span class="mt-1 ml-2">{{
				            formData.id_card_show ? '展示' : '隐藏'
				        }}</span>
				    </div>
				</el-form-item>
				<el-form-item label="服务凭证展示" prop="service_voucher_show">
				    <div>
				        <el-switch
				            v-model="formData.service_voucher_show"
				            :active-value="1"
				            :inactive-value="0"
				        />
				        <span class="mt-1 ml-2">{{
				            formData.service_voucher_show ? '展示' : '隐藏'
				        }}</span>
				    </div>
				</el-form-item>
<!-- 				<el-form-item label="退款按钮展示" prop="is_refund">
				    <div>
				        <el-switch
				            v-model="formData.is_refund"
				            :active-value="1"
				            :inactive-value="0"
				        />
				        <span class="mt-1 ml-2">{{
				            formData.is_refund ? '展示' : '隐藏'
				        }}</span>
				    </div>
				</el-form-item> -->
				<el-form-item label="退款按钮展示" prop="appKey">
				    <div class="w-80">
				        <el-input v-model="formData.refund_time" style="width: 240px" placeholder="请输入时间" >
							<template #append>小时</template>
						</el-input>
						<div class="form-tips">说明：0则不展示，输入数值则为展示时间</div>
				    </div>
				</el-form-item>
				</el-card>
        </el-form>
        <footer-btns>
            <el-button type="primary" @click="handleSubmit">保存</el-button>
        </footer-btns>
    </div>
</template>

<script lang="ts" setup name="webInformation">
import { info,set } from '@/api/setting/show_set'
import useAppStore from '@/stores/modules/app'
import type { FormInstance } from 'element-plus'
const formRef = ref<FormInstance>()

// 表单数据
const formData = reactive({
    contract_show: '', // 合同
    id_card_show: '', // 身份证
    service_voucher_show: '', // 服务凭证
	is_refund:'',
	refund_time:0
})

// 获取展示数据
const getData = async () => {
    const data = await info()
	for (const key in formData) {
	    //@ts-ignore
	    formData[key] = data[key]
	}
}


// 提交保存
const handleSubmit = async () => {
    const res = await set(formData)
    getData()
}

getData()
</script>

<style lang="scss" scoped></style>
